home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / futils.arc / FILE1.DOC < prev    next >
Text File  |  1991-04-28  |  3KB  |  81 lines

  1.  
  2. *******************************************************************
  3. ************************ FILE1 by Rex Kerr ************************
  4. ************************ Copyright (C) 1989 ***********************
  5. *******************************************************************
  6.  
  7. FILE1 is a TP5.5 unit that performs various operations on files.
  8.  
  9.    I wrote this unit after I got tired of writing simple file
  10. operations over and over again.  The one I use most is existfile,
  11. but the others are also useful.  This program also does most of
  12. the work in a file managing program I wrote, DirPlus.  You can
  13. download it (the file name is 'DPLUS.ARC') from Lib 1 of the BPROGA
  14. forum on CompuServe.
  15.  
  16. ***
  17.  
  18. ExistFile(st : pathstr) : boolean;
  19.  
  20. This returns true if the filename st exists; otherwise it returns
  21. false.
  22.  
  23. ***
  24.  
  25. CopyFile(fromfile,tofile : pathstr; var result : byte);
  26.  
  27. This copies the file specified in fromfile to the one specified
  28. in tofile.  The result bytes returns 0 if the operation was
  29. succesful.  If not, it will return one of these error codes:
  30.     1 :  File to copy from does not exist as specified
  31.     2 :  File to copy to already exists as specifed  (FILE1 won't
  32.          overwrite existing files.)
  33.     3 :  Heap too small to create file copy buffer  (FILE1 needs
  34.          at least 1k of heap, and will use up to 64k, if it is
  35.          available.)
  36. Copying starts at the destination, not at the source.  First the
  37. destination file is opened, then the source file.  Then the
  38. source file is read, and the destination file is written to.  It
  39. takes a bit of getting used to, but this is the fastest way to copy
  40. a file.
  41.  
  42. ***
  43.  
  44. RenameFile(fromfile,tofile : pathstr; var result : byte);
  45.  
  46. This renames the file in fromfile to the name in tofile.  The result
  47. byte returns 0 if it is successful.  Otherwise, it returns one of
  48. the non-zero error codes shown below:
  49.      1 :  File to rename does not exist as specified
  50.      2 :  Name to rename to already exists as specified
  51.  
  52. ***
  53.  
  54. EraseFile(delfile : pathstr; var result : byte);
  55.  
  56. EraseFile erases the file named in delfile.  The result byte returns
  57. 0 if it is succesful.  If not, it returns one of the below error
  58. codes:
  59.      1 :  File as specified does not exist to erase
  60.  
  61. ***
  62.  
  63. TypeFile(showfile : pathstr; var result : byte);
  64.  
  65. This types the file named in showfile to the current TP5 window on
  66. the screen.  While it is typing the file out, if any key is pressed,
  67. it will stop and wait until another key is pressed.  When it is,
  68. the writing to the screen will continue.  If ESC is pressed at any
  69. time during the type, the procedure will end.  If typing is
  70. succesfully started, the result byte will contain 0.  Otherwise, it
  71. will contain one of the error codes shown below:
  72.      1 :  File to type does not exist as specified
  73.      2 :  Heap too small  (TypeFile also needs at least 1k of heap,
  74.           it will use up to 64k if that much is available.)
  75.  
  76. ***
  77.  
  78.    This unit is written in Pascal, not in assembly language.  File
  79. operations are fast enough in TP so that assembly language is not
  80. needed for speed, and Pascal is much easier to write in.
  81.